namespace KinonekoSoftware.Studio
{
    public sealed class LayeredTree<TKey, TValue> where TValue : class
    {
        //
        // Backend，主要指的是Database
        // InMem，主要指的是Database中数据提取到内存中的List 
        // Layer，主要指的是当前进入的所有层次。
        // Collection，主要指的是当前层次下所有的节点。
        // 

        public class LayeredNode
        {
        }

        private readonly Dictionary<TKey, LayeredNode> _dictionary;

        private int _count;
        private int _version;
        private int _maxDepth;

        public LayeredTree()
        {
            _dictionary = new Dictionary<TKey, LayeredNode>();


            LayerCollection = new ObservableCollection<TValue>();
            ItemCollection    = new ObservableCollection<TValue>();
        }

        /// <summary>
        /// 剪枝操作
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public LayeredNode Pruning(TValue value)
        {
            return null;
        }
        
        /// <summary>
        /// 剪枝操作
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public LayeredNode Detach(TValue value)
        {
            return null;
        }

        public void Attach()
        {
            
        }

        public void DFS()
        {
            
        }

        public void BFS()
        {
            
        }

        public void Add(TValue value)
        {
            
        }
        
        public void ShiftUp(TValue value)
        {
            
        }
        
        public void ShiftDown(TValue value)
        {
            
        }

        public void Remove(TValue value)
        {
            
        }

        public void Clear()
        {
            
        }

        public ObservableCollection<TValue> LayerCollection { get; }
        public ObservableCollection<TValue> ItemCollection    { get; }

        public int Depth => _maxDepth;
        public int Count => _count;

        public TValue Layer { get; set; }
        
        public required Func<TValue, TKey> KeySelector { get; init; }
    }
}